/**
 * 案列：定义一个函数，传递一个数组，返回最大值
 */
function getMaxValue(array:number[]):number{
    let max = array[0]
    array.forEach(item=>max=item>max?item:max)
    return max
}

const maxValue = getMaxValue([1,3,6,9,2])

function getMaxValue2(array:string[]):string{
    let max = array[0]
    array.forEach(item=>max=item>max?item:max)
    return max
}
const maxValue2 = getMaxValue2(["a","b","c"])

function getMaxValue3<K>(array:K[]):K{
    let max = array[0]
    array.forEach(item=>max=item>max?item:max)
    return max
}
getMaxValue3<number>([1,2,3,5])
getMaxValue3<string>(["a","b"])
getMaxValue3<boolean>([true,false])











